<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
//    return $request->user();
//});

Route::group(['prefix'=>'/'],function (){
    //登录
    Route::post('login',[App\Http\Controllers\Admin\AuthController::class, 'login']);
    //登出
    Route::post('logout',[App\Http\Controllers\Admin\AuthController::class, 'logout']);

    Route::group(['middleware'=>'token'],function (){
        //获取字典列表
        Route::get('dict',[App\Http\Controllers\Admin\DictController::class, 'index']);
        //添加字典
        Route::post('dict',[App\Http\Controllers\Admin\DictController::class, 'add']);
        //编辑字典
        Route::post('dict/{id}/edit',[App\Http\Controllers\Admin\DictController::class, 'edit']);
        //删除字典
        Route::post('dict/{id}/del',[App\Http\Controllers\Admin\DictController::class, 'del']);
    });
});
